import {request} from "@/utils/http";
import type { HospitalShowType, ProvinceList, ReqGetHospitalListParams, ReqGetHospitalListResponse } from "./model/hospitalListTypes";
import { Status } from '@api/hospital/model/hospitalListTypes';


//获取医院列表
export const reqGetHospitalList =({page,limit,...restParams}:ReqGetHospitalListParams)=>{
  return request.get<any,ReqGetHospitalListResponse>(`/admin/hosp/hospital/${page}/${limit}`,{
    // query 参数  
    // ...restParams 代表剩余其它参数
    params:restParams
  });
}

// 获取省份数据
export const reqGetProvinceList =(dictCode="province")=>{
  return request.get<any,ProvinceList>(`/admin/cmn/dict/findByDictCode/${dictCode}`);
}

// 获取市/区/医院类型数据
export const reqGetCityOrDistrictList =(parentId:number)=>{
  return request.get<any,ProvinceList>(`/admin/cmn/dict/findByParentId/${parentId}`);
}

//获取医院详情
export const reqGetHospitalShow = (id:string) =>{
  return request.get<any,HospitalShowType>(`/admin/hosp/hospital/show/${id}`);
}

//医院上线的接口函数
export const reqUpdateHospitalStatus = (id:string,status:Status ) =>{  // （Status---0：未上线 1：已上线）
  return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`);
}
